﻿/**
 * Scene_Title
 * 
 * @version 2012.01.12
 * @author  Bruno Miguel de Oliveira Tamer <bmotamer@gmail.com>
 */

#region SDK Libraries

using Main.SDK.Audio;
using Main.SDK.Display;
using Main.SDK.Display.Object2D;
using Main.SDK.Input;
using Main.SDK.Scene;

#endregion

namespace Main.SRC.Scene
{

    public sealed class Scene_Game : Scene_Base
    {

        Sprite Background   = new Sprite("RSC/Picture/Background");
        Sprite SoccerPlayer = new Sprite("RSC/Picture/Soccer Player");
        Sprite Title        = new Sprite("RSC/Picture/Title_v2");
        Sprite Ball         = new Sprite("RSC/Picture/Ball");
        Sprite PlayButton   = new Sprite("RSC/Picture/Play_Button");
        Sprite OptionButton = new Sprite("RSC/Picture/Option_Button");
        
        int    Distance     = 52;
        int    Index        = 0;

        #region Instance Methods

        public override void Start()
        {
            Audio.PlayBGM("RSC/Audio/Title");

            SoccerPlayer.X = -SoccerPlayer.Width;
            SoccerPlayer.Y = 128;

            Title.X = Program.Graphics.PreferredBackBufferWidth;
            Title.Y = 32;

            Ball.OX = Ball.Width / 2;
            Ball.OY = Ball.Height / 2;
            Ball.XO = 32;
            Ball.YO = 160;
            Ball.Visible = false;

            PlayButton.X = 68;
            PlayButton.Y = 154;
            PlayButton.Visible = false;

            OptionButton.X = 68;
            OptionButton.Y = 207;
            OptionButton.Visible = false;
        }

        public override void Update()
        {
            if (SoccerPlayer.X < 300)
            {
                SoccerPlayer.X += 50;
                Title.X -= 51f;
            }
            else
            {
                Ball.Visible = true;
                Ball.Degrees += 8;

                //PlayButton.Visible = true;
                //OptionButton.Visible = true;
            }
            /*if (Input.Trigger(Microsoft.Xna.Framework.Input.Keys.Escape))
                Scene.Set(null);*/

            if (Input.Trigger(Microsoft.Xna.Framework.Input.Keys.Down) && Index == 0)
            {
                Ball.Y += Distance;
                Index = 1;
            }
            else if (Input.Trigger(Microsoft.Xna.Framework.Input.Keys.Down) && Index != 0)
            {
                Ball.YO = 160;
                Index = 0;
            }
        }

        public override void Terminate()
        {
        }

        #endregion

    }

}